package com.shoukaiseki.xutils.simple;

import com.shoukaiseki.xutils.simple.R;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class HelloTabActivity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Resources res = getResources();//得到Drawables的资源对象
        TabHost tabHost = getTabHost();//TabHost 的Activity
        TabHost.TabSpec spec;
        Intent intent;
        
        //创建一个intent发送请求到AcrtistsActivity
        intent = new Intent(this,Test001Activity.class);
        
        //初始化一个TabSpec（选项卡），并且添加它到TabHost;
        spec = tabHost.newTabSpec("artists").setIndicator("按钮+标签",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        //为其它两个Tab做同样的动作
        intent = new Intent(this,Test002Activity.class);
        spec = tabHost.newTabSpec("albums").setIndicator("表格",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent(this,Test003Activity.class);
        spec = tabHost.newTabSpec("songs").setIndicator("通讯录List",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent(this,Test004Activity.class);
        spec = tabHost.newTabSpec("testlog").setIndicator("测试log",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent(this,Test005Activity.class);
        spec = tabHost.newTabSpec("testjson").setIndicator("测试JSON+http",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent(this,Test006Activity.class);
        spec = tabHost.newTabSpec("testlayout").setIndicator("测试layout",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent(this,Test007Activity.class);
        spec = tabHost.newTabSpec("testlogin").setIndicator("测试login",
        		res.getDrawable(R.drawable.ic_tab)).setContent(intent);
        tabHost.addTab(spec);
        
        //默认标签页
        tabHost.setCurrentTab(0);
    }
}
